<%@ page language="java" import="java.util.*" import="java.text.SimpleDateFormat" pageEncoding="UTF-8"%>
<%@ page import="com.bluesky.light.user.*"%>
<%@ page import="com.bluesky.light.order.*" %>
<%@ page language="java" import="com.bluesky.light.admin.*"%>
<%
request.setCharacterEncoding("utf-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	// check if the user is login
	User u = (User)session.getAttribute("user");
	if (u == null) {
		response.sendRedirect("index.jsp");
	}	
	String name = u.getName();
%>
<%
	List<TreatOrder> orders = OrderService.getInstance().getOrders();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>light - change info</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="css/main.css" rel="stylesheet" type="text/css" />


	
  </head>
  
  <body onload = "checkAge(changeinfo.birth_year.value,changeinfo.birth_month.value)">
	<!-- header -->
	<div id="header">
		<div id="logo"><img src="images/logo_small2.png"/></div>
	</div>
	<!-- // header -->
	<!-- nav -->
	<div id="nav">
	</div>
	<!-- // nav -->
	<!-- container -->
	<div id="container">
		<!-- contents -->
		<div id="contents">
	    	<div id="menu">
	        	<div>
	        		<div id="user_info">
	            		<img src="develop/user_icon.jpg"/> 
	            		<b>User</b>
	           		</div>
	           		<div>
	           		<%=name%>
	           		</div>
	            </div>
	            <div>
	            	<%SimpleDateFormat sdf = new SimpleDateFormat("EEE, yyyy-MM-dd", new Locale("US"));%><%=sdf.format(new Date())%><br></br>
	            </div>
	        	<ul>
	            	<li><a href="home.jsp"><img src="images/news.png" /> Health News</a></li>
	                <li><a href="user_subscribe.jsp"><img src="images/surscribe.png" /> Appointment</a></li>
	                <li><a href="user_history.jsp"><img src="images/account.png" /> Health History</a></li>
	                <li><a href="home.jsp"><img src="images/photo.png" /> Searching Hospital</a></li>
	                <li><a href="user_infoModifyInput.jsp"><img src="images/account.png" /> Account Management</a></li>	          
	                <li><a href="index.jsp"><img src="images/account.png" /> logout</a></li>
	            </ul>	            
	        </div>
	       <div id="main-cont">
	            <div id="result">
	                <table class="resulttable" rules="all" >
	                	<caption>Order List</caption>
	                    <tr>
	                        <th>ID</th><th>Date</th><th>Symptom</th><th>Medicine</th><th>Status</th><th>Patient</th><th>Doctor</th>
	                    </tr>
	         			<% 
	         				for (int i = 0; i < orders.size(); i++) {
	         					TreatOrder to = orders.get(i);
	         					
	         					if(u.getName().equals(to.getUsername())) {
	         			%>
	         			<tr>
	         				<td><%=to.getId()%></td>
	         				<td><%=to.getoDate()%></td>
	         				<td><%=to.getSymptom()%></td>
	         				<td><%=to.getItems() %>></td>
	         				<td><%=to.getStatus()%></td>
	         				<td><%=to.getUsername()%></td>
	         				<td><%=to.getStaffname()%></td>
	         			</tr>
						<%
	         					}
	         				}
						%>
	                </table>		
	        	</div>
	    </div>
	    </div>
	    <!-- // contents -->
	</div>
	<!-- // container -->
	<div id="footer">
		<div id="bs_stdio">
	    	©2011-2011 www.bluesky.com.mo All Rights Reserved<br/>
	    	<img src="images/bluesky_logo.png" />
	    </div>
	</div>
  </body>
</html>
